
    public class EulerProblem2 {
       /* int firstNumber=0;
        int secondNumber=1;*/
        int limit=4000000;

//                  EulerProblem2(int firstNumber,int secondNumber,int limit){
//                                this.firstNumber=firstNumber;
//                                this.secondNumber=secondNumber;
//                                this.limit=limit;
//                         }
              int nthTermFinder(int n){
                  int sum=0,sum1=0;      int firstNumber=0;
        int secondNumber=1;
                  for(int i=0; i<n;i++){
                      sum = firstNumber + secondNumber ;
                      firstNumber=secondNumber;
                      secondNumber=sum;
//                     System.out.println("i :"+i+" sum:"+sum);
                  }

//                  System.out.println("n :"+n+" sum:"+sum);
                  return sum;
              }

        boolean IsItEvenTerm(int n){
            return nthTermFinder(n)%2==0;
        }

        public static void main(String ag[]){
//                   EulerProblem2 e = new EulerProblem2(0,1,4000000);
            EulerProblem2 e = new EulerProblem2();
                   int n=1;
                    int sum=0;
                    for(int i=1 ;e.nthTermFinder(i)<=e.limit;i++){
                        if(e.IsItEvenTerm(i)){
                         sum =sum+    e.nthTermFinder(i) ;
//                            System.out.println("sum inside if:" + sum +" i:"+i);
                        }
//                        sum =sum+    e.nthTermFinder(i) ;
                        System.out.println("sum inside for:" + sum +" i:"+i);
                    }

//                   System.out.println("sum:" + e.nthTermFinder(8));
//            System.out.println("sum:" + e.nthTermFinder(8) +"  " + e.IsItEvenTerm(8));
        }

    }
